import java.io.*;
import java.net.*;

public class WheelsClient {
	private static final int SOCKET_PORT = 44444;
	/**
	 * @param args
	 */
	public static void main(String[] args) throws IOException {
		final int RESUME_COUNT = 101;
		
		Socket clientSocket = null;
		ObjectOutputStream out = null;
		BufferedInputStream in = null;
		String localhostName = "";
		try {
			//This localhostName works only in the case when client
			//and server run on the same machine. Otherwise name of host
			//should be changed.
			localhostName = InetAddress.getLocalHost().getHostName();
			clientSocket = new Socket(localhostName,SOCKET_PORT);
			out = new ObjectOutputStream(clientSocket.getOutputStream());
			in = new BufferedInputStream(new ObjectInputStream(clientSocket.getInputStream()));
		} catch (UnknownHostException e){
			System.err.println("Wrong hostname: " + localhostName);
			System.exit(1);
		} catch (IOException e){
			System.err.println("I/O error in the connection to: "+localhostName);
			System.exit(1);
		}
		ContainerResumeSer containerSer = new ContainerResumeSer();
		ContainerResumeExt containerExt = new ContainerResumeExt();
		for (int i=0; i<RESUME_COUNT; i++){
			ResumeSer resumeSer = new ResumeSer();
			ResumeExt resumeExt = new ResumeExt();
			containerSer.addItem(resumeSer);
			containerExt.addItem(resumeExt);
		}
		out.writeObject(containerExt);
		out.writeObject(containerSer);
		
		out.close();
		in.close();
		clientSocket.close();

	}
}
